<!DOCTYPE html>
<head>
  <script src="../../resources/testharness.js"></script>
  <script src="../../resources/testharnessreport.js"></script>
</head>
<body>
  <iframe id="formiframe" name="formiframe"></iframe>
  <form target="formiframe" id="myform" action="/forms/resources/return-content-type.php" enctype="multipart/form-data" method="post">
    <input type="text" name="textinput" value="hello world">
    <input type="file" name="fileinput" id="fileinput">
    <input type="submit">
  </form>
  <script>
    window.test(() => {
      if (!window.eventSender)
        return;
      const fileinput = document.getElementById('fileinput');
      window.eventSender.beginDragWithFiles(['resources/hello_world.xlsx']);
      const centerx = fileinput.offsetLeft + fileinput.offsetWidth / 2;
      const centery = fileinput.offsetTop + fileinput.offsetHeight / 2;
      window.eventSender.mouseMoveTo(centerx, centery);
      window.eventSender.mouseUp();
      assert_equals(fileinput.files[0].type, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
    });
  </script>
</body>
